-- Should really be in the openStack handler, but, at least for me,
-- this never gets executed!?!
if the short version of HyperCard < 1.2 then
answer "This stack needs HyperCard 1.2 or later to run." with "Sorry"
go home
end if
show menubar
hide msg box
pass openBackground
end openBackground
-- part 85 (field)
-- low flags: 01
-- high flags: 0000
-- rect: left=288 top=113 right=128 bottom=337
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: version
-- part 80 (button)
-- low flags: 00
-- high flags: A004
-- rect: left=140 top=305 right=335 bottom=251
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Export BibTeX…
----- HyperTalk script -----
on mouseUp
global gFileName
put rawFileName(gFileName) into rawFile
if rawFile is empty
then put the short name of this stack & ".bib" into rawFile
put StdFile(put, "Save to BibTeX file:", rawFile) into newFile
if newFile is empty then exit mouseUp
answer "Is this for use with WordRef?" with "Cancel" or "Other BibTeX" or "WordRef"
put it into doWordRef
if it is "Cancel" then exit mouseUp
set cursor to watch
put newFile into gFileName
lock screen
WriteBibTeX gFileName, doWordRef
unlock screen
hide msg box
end mouseUp
-- returns the "short" name of a file name
function rawFileName fileName
put offset(":",fileName) into index
repeat while index <> 0
put the number of chars of fileName into numChars
put char index+1 to numChars of fileName into fileName
put offset(":",fileName) into index
end repeat
return fileName
end rawFileName
-- part 82 (button)
-- low flags: 00
-- high flags: 2004
-- rect: left=8 top=246 right=286 bottom=48
-- title width / last selected line: 0
-- icon id / first selected line: 8538 / 8538
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Find
----- HyperTalk script -----
on mouseUp
doMenu "Find..."
end mouseUp
-- part 84 (button)
-- low flags: 00
-- high flags: A004
-- rect: left=353 top=305 right=335 bottom=410
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Clear…
----- HyperTalk script -----
on mouseUp
answer "Really delete all references from the stack?" with "Yes" or "No"
if it is "No" then exit mouseUp
set cursor to watch
lock screen
put the id of this card into myself
go next
repeat until the id of this card is myself
-- clear the card if it's the last of its kind
if the number of cds of this bg = 1 then
repeat with i = 1 to the number of bg flds
put empty into bg field i
end repeat
go next
else
doMenu "Delete Card"
end if
end repeat
unlock screen
end mouseUp
-- part 86 (field)
-- low flags: 01
-- high flags: 0001
-- rect: left=107 top=45 right=82 bottom=456
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 20
-- text size: 24
-- style flags: 256
-- line height: 32
-- part name: Title
-- part 87 (button)
-- low flags: 00
-- high flags: A004
-- rect: left=140 top=273 right=303 bottom=251
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Import BibTeX…
----- HyperTalk script -----
on mouseUp
put StdFile(get, "TEXT") into inFile
if inFile is empty then exit mouseUp
set cursor to watch
lock screen
ReadBibTeX inFile
if the result is not empty then
answer the result with "OK"
end if
put "Sorting..."
sort by fld "keyField"
unlock screen
hide msg box
end mouseUp
-- part 89 (button)
-- low flags: 00
-- high flags: A004
-- rect: left=257 top=273 right=303 bottom=410
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Find Duplicate Keys
----- HyperTalk script -----
on mouseUp
set cursor to watch
lock screen
sort by bg fld "keyField"
put the id of this cd into myself
go next
put empty into lastKey
repeat until the id of this cd is myself
if bg fld "keyField" is not empty then
if bg fld "keyField" = lastKey then
put "This card and the previous have key" && quote & lastKey & quote
exit mouseUp
end if
put bg fld "keyField" into lastKey
end if
go next
end repeat
unlock screen
put "No duplicates"
end mouseUp
-- part 88 (button)
-- low flags: 00
-- high flags: 2004
-- rect: left=8 top=204 right=244 bottom=48
-- title width / last selected line: 0
-- icon id / first selected line: 32462 / 32462
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Help
----- HyperTalk script -----
on mouseUp
show cd fld "Help Field"
end mouseUp
-- part 90 (button)
-- low flags: 00
-- high flags: 2000
-- rect: left=70 top=17 right=57 bottom=110
-- title width / last selected line: 0
-- icon id / first selected line: 24830 / 24830
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Next
----- HyperTalk script -----
on mouseUp
lock screen
go card 15
-- put the id of this cd into myself
-- go next
-- repeat until the id of this cd is myself
-- if bg fld "keyField" is not empty then exit mouseUp
-- go next
-- end repeat
end mouseUp
-- part 91 (button)
-- low flags: 00
-- high flags: A004
-- rect: left=257 top=305 right=335 bottom=348
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: New Stack…
----- HyperTalk script -----
on mouseUp
put the short name of this stack into source
put StdFile(put, "Save a Copy:","Copy of"&&source) into dest
if dest is empty then exit mouseUp
set cursor to watch
put word 2 of the long name of this stack into source
put char 2 to number of chars of source - 1 of source into source
CopyFile source,dest
if the result is not empty then
put "Error in copy:" && the result
exit mouseUp
end if
go dest
end mouseUp
-- part 93 (button)
-- low flags: 00
-- high flags: 2004
-- rect: left=8 top=36 right=76 bottom=48
-- title width / last selected line: 0
-- icon id / first selected line: 20098 / 20098
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Home
----- HyperTalk script -----
on mouseUp
visual iris close
go home
end mouseUp
-- part 94 (button)
-- low flags: 00
-- high flags: 2004
-- rect: left=8 top=78 right=118 bottom=48
-- title width / last selected line: 0
-- icon id / first selected line: 3430 / 3430
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: New Item
----- HyperTalk script -----
on mouseDown
get PopUpMenu(0, "Article,Book,Booklet,InBook,InCollection", "InProceedings,Manual,MastersThesis,Misc,PhDThesis", "Proceedings,TechReport,Unpublished")